<template>
    <div class="gender">
        <div class="top">
            <p class="radio">男女比例</p>
            <p class="radion_bg"></p>
        </div>
        <div class="main">
            <div class="man">
                <div>男生</div>
                <img src="../images/man.png" alt="" style="width: 61px;height: 61px;">
            </div>
            <div class="women">
                <div>女生</div>
                <img src="../images/woman.png" alt="">
            </div>
        </div>
        <div class="rate">
            <p>男生60%</p>
            <p>女生40%</p>
        </div>
        <div class="charts" ref="charts">

        </div>
    </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
import * as echarts from 'echarts';
const charts = ref()
onMounted(() => {
    const myChart = echarts.init(charts.value);
    myChart.setOption({
        xAxis: {
            show: false,
            min: 0,
            max: 100
        },
        yAxis: {
            type: 'category',
        },
        series: [
            {
                data: [60],
                type: 'bar',
                barWidth: '20',
                z: 10,
                itemStyle: {
                    color: 'skyblue',
                    borderRadius: 20
                }
            },
            {
                data: [100],
                type: 'bar',
                barWidth: '20',
                barGap: '-100%',
                itemStyle: {
                    color: 'pink',
                    borderRadius: 20
                }
            }
        ],
        grid: {
            top: 0,
            left: 80,
            right: 80,
            bottom: 0
        }
    })
})
</script>

<style lang="scss" scoped>
.gender {
    width: 100%;
    height: 262px;
    margin: 10px 0;
    background: url(../images/dataScreen-main-lc.png) no-repeat;
    background-size: cover;

    .top {
        .radio {
            color: white;
            font-size: 20px;
        }

        .radion_bg {
            width: 68px;
            height: 7px;
            margin-top: 10px;
            background: url(../images/dataScreen-title.png);
        }
    }

    .main {
        margin-top: 20px;
        display: flex;
        justify-content: center;

        .man {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            width: 111px;
            height: 116px;
            color: white;
            margin-right: 15px;
            background: url(../images/man-bg.png) no-repeat;
            background-size: cover;

        }

        .women {
            width: 111px;
            height: 116px;
            display: flex;
            flex-direction: column;
            align-items: center;
            color: white;
            justify-content: space-between;
            background: url(../images/woman-bg.png) no-repeat;
            background-size: cover;
        }
    }

    .rate {
        display: flex;
        margin-top: 10px;
        color: white;
        justify-content: space-around;
    }

    .charts {
        width: 100%;
        height: 30px;
    }
}
</style>